<?php 
	
	$tblBanner = new Zendvn_Model_Table_Slider();
	$arrBanner = $tblBanner->listSlides($this->arrParam);
	if(!empty($arrBanner)){
		$config = new Zendvn_Controller_Config(array('module' => 'admin', 'fileConfig' => 'slider.ini'));
		$itemConfig = $config->getConfig('slider');
?>
<div class="slider" id="slider">
	<?php 
	foreach ($arrBanner as $k => $v):
		$name		= Zendvn_Filter_Filter::filterContent($v['name']);
		$link		= empty($v['link'])?'javascript:void(0);':$v['link'];
		$description = Zendvn_Filter_Filter::filterContent($v['description']);
		
		$picture 	= $v['picture'];
		if(file_exists($itemConfig['uploadDir'] . '/' . $picture) && !empty($picture)){
			$picture = $itemConfig['uploadUrl'] . '/' . $picture;
		}else{
			continue;
		}
	?>
		<a href="<?php echo $link?>">
			<img src="<?php echo $picture?>" data-thumb="<?php echo $picture?>" alt="" title="" />
		</a>
	<?php endforeach;?>
</div>
<script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider({
        	effect:'random', //Specify sets like: 'fold,fade,sliceDown'
			slices: 12,
			directionNav:true, //Next & Prev
			directionNavHide:true, //Only show on hover
			controlNav:true, //1,2,3...
			keyboardNav:true //Use left & right arrows
        });
        //$('.nivo-controlNav').css('margin-right', '-' + parseInt($('.nivo-controlNav').css('width'))/2 + 'px');
    });
</script>
<?php 
	}else{
		echo $this->render('includes/main-image.php');
	}
?>
